Introduction
This new version 4.0 feature enables users to click on a chart and obtain the value of any axis, at the specific click location. This allows users to interact with the chart by selecting a point or range on a given axis.
Usage
When the chart is clicked, the coordinates of the mouse click on the image must be supplied to the chart. This is achieved by using a custom image tag with the ISMAP attribute or an image type input tag .
In order to use this feature the default hotspot functionality cannot be used. |
For example a working html tag that will return the coordinates will look like this:
<IMG src="dnc-1j4hgd.png" ISMAP>
To get the x y coordinates that can be passed to the axis:
[C#]
string coordinates = Page.Request.QueryString[0];
[Visual Basic]
Dim coordinates As String = Page.Request.QueryString(0)
OR
<FORM method=get> <INPUT Type=Image SRC="dnc-1j8d9ahj.png" Value=Submit > </FORM>
To get the x y coordinates that can be passed to the axis:
[C#]
string coordinates = Page.Request.Params["x"] + "," + Page.Request.Params["y"];
[Visual Basic]
Dim coordinates As String = Page.Request.Params("x") & "," & Page.Request.Params("y")
When the coordinates are retrieved they can be passed to the axis.GetValueAtX() or axis.GetValueAtY() method and the value on the axis at this coordinate is returned as an object. If null is returned, the coordinates were not valid for the particular axis.
In WebForms, because the chart object does not maintain a state through postbacks, the chart must be generated before this method can be called. |
For more information on arbitrarily generating the chart, see this kb article.
Samples:
- XAxisZoom.aspx
- YAxisZoom.aspx
- AxisValueClick.aspx